using System;
using System.Collections.Generic;
using FireStarter.CodeGeneration;
using FireStarterModeller.BO;
using NUnit.Framework;

namespace FireStarter.Test.CodeGeneration
{
    [TestFixture]
    public class TestModelProperty : TestBase
    {

        [Test]
        public void Test_IsCompulsory()
        {
            //---------------Set up test pack-------------------
            DMProperty modelProperty = new DMProperty();
            //---------------Assert Precondition----------------
            Assert.IsFalse(modelProperty.Compulsory.Value);
            //---------------Execute Test ----------------------
            modelProperty.Compulsory = true;
            //---------------Test Result -----------------------
            Assert.IsTrue(modelProperty.Compulsory.Value);
        }

        [Test]
        public void Test_SetPropertyType()
        {
            //---------------Set up test pack-------------------
            DMProperty dmProperty = new DMProperty();

            DMPropertyType dmPropertyType = new DMPropertyType();
            string typeName = TestUtilsCodeGen.GetRandomString();
            string assemblyName = TestUtilsCodeGen.GetRandomString();
            dmProperty.PropertyType = dmPropertyType;
            //---------------Assert Precondition----------------
            Assert.IsNotNull(dmPropertyType);
            Assert.IsNull(dmPropertyType.PropertyTypeName);
            Assert.IsNull(dmPropertyType.AssemblyName);
            //---------------Execute Test ----------------------
            dmPropertyType.PropertyTypeName = typeName;
            dmPropertyType.AssemblyName = assemblyName;
            //---------------Test Result -----------------------
            Assert.AreEqual(typeName, dmPropertyType.PropertyTypeName);
            Assert.AreEqual(assemblyName, dmPropertyType.AssemblyName);
        }
    }
}